package org.robot.test;

import org.robot.Spider;
import org.robot.component.Page;

public class RscJournal extends Spider {

    public static void main(String[] args) {
        RscJournal claw = new RscJournal();
        claw.setBaseDirectory("e:/webSpider/RscJournal");
        claw.addSeed("http://pubs.rsc.org/en/journals?key=title&value=current");
//        claw.addByHand();
        claw.addRegex("http://pubs.rsc.org/en/journals/journal/\\w+", "journal");

        claw.start();
        

    }

    @Override
    public void parse(Page page) throws Exception {
        if (page.isSeed()) {
//            page.addNext(Rule.createRegexRule("http://pubs.rsc.org/en/journals/journal/\\w+", "journal"));
        }
        System.out.println(page.url());
        if (page.typeEquals("journal")) {
            String prevUrl = page.prevUrl();
            System.out.println(prevUrl);
        }
    }

}
